package com.ayu.springsecuritylearn.advice;


import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;


/**
 * @Author: 徐林玉//作者及
 * @Date: 2021/9/26//完成日期
 * @Description: //
 * @Version: v0.0.1 // 版本信息
 * @Function List: // 主要函数及其功能
 * @Others: // 其它内容的说明
 * @History: // 历史修改记录
 **/

@ControllerAdvice
@Slf4j
public class ExcepHandlerAdvice
{

	@ExceptionHandler(RuntimeException.class)
	public String runtimeExceptionHandler(RuntimeException e){

		if(e instanceof AccessDeniedException){

			return "redirect:/403.jsp";
		}

		return "redirect:/500.jsp";
	}


}
